#coding=utf-8
from python3.common.util.conn_database import get_cursor,get_conn
from python3.common.core.entity.base.base_entity import BaseEntity
from datetime import datetime

class SysMenu(BaseEntity):
    table_name="sys_menu"
    def __init__(self,id=None,menu_name=None,menu_type=None,menu_url=None,sort=None,remarks=None,del_flag=0):
        BaseEntity.__init__(self,id,remarks,del_flag)
        self.menu_name=menu_name
        self.menu_type=menu_type
        self.menu_url=menu_url
        self.sort=sort

    # @classmethod
    # def find_by_login_name(cls, entity):
    #     conn = get_conn()
    #     # 暂时所有的类的sql都直接放置在sql文件夹下不重新进行区分
    #     moudle = cls.get_sql_module()
    #     cursor = get_cursor(conn)
    #     cursor.execute(moudle.selectOneByLoginName(entity))
    #     data = cursor.fetchone()
    #     base_entity = None
    #     if data != None:
    #         base_entity = cls.get_object()
    #         for key in data:
    #             setattr(base_entity, key, data[key])
    #
    #     cursor.close()
    #     conn.close()
    #     return base_entity

    def test():
        menu = SysMenu(menu_name="test", menu_type=0, menu_url="www.baidu.com", sort=1)
        SysMenu.save(menu)
if __name__=="__main__":
    menu=SysMenu(menu_name="test",menu_type=0,menu_url="www.baidu.com",sort=1)
    SysMenu.save(menu)